[#10808] Improvement(client-python): Add Owner management API (get_owner / set_owner)#10809
Open
sunyuhan1998 wants to merge 1 commit intoapache:mainfrom
Open
[#10808] Improvement(client-python): Add Owner management API (get_owner / set_owner)#10809sunyuhan1998 wants to merge 1 commit intoapache:mainfrom
sunyuhan1998 wants to merge 1 commit intoapache:mainfrom
Conversation
…get_owner / set_owner) Add Owner API to the Python SDK to align with the Java client's getOwner/setOwner methods, enabling ownership management of metadata objects through the SDK instead of raw REST calls.
Contributor
Author
|
@roryqi Hi, could you please help review this PR? Thank you very much. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Add
get_owner/set_ownerAPI to the Python SDK, aligning with the Java client'sGravitinoMetalake.getOwner()/setOwner()methods.New files:
gravitino/api/authorization/owner.py— Owner interface withTypeenum (USER/GROUP)gravitino/dto/authorization/owner_dto.py— OwnerDTOgravitino/dto/requests/owner_set_request.py— setOwner request bodygravitino/dto/responses/owner_response.py— getOwner responsegravitino/dto/responses/set_response.py— setOwner responsegravitino/exceptions/handlers/owner_error_handler.py— Owner error handlerModified files:
gravitino/client/gravitino_metalake.py— Addget_owner/set_ownermethodsgravitino/client/gravitino_client.py— Add delegation methodsWhy are the changes needed?
The Java SDK already supports ownership management, but the Python SDK lacks these APIs. Users must fall back to raw REST calls via
requests, which is inconsistent with the SDK design.Fix: #10808
Does this PR introduce any user-facing change?
Yes, two new public APIs are added:
GravitinoClient.get_owner(metadata_object)→Optional[Owner]GravitinoClient.set_owner(metadata_object, owner_name, owner_type)→NoneNo existing APIs are changed.
How was this patch tested?
Unit tests added in
tests/unittests/test_owner.py(17 test cases):get_owner(user/group/none),set_owner(success/false)ILLEGAL_ARGUMENTS,NOT_FOUND,UNSUPPORTED_OPERATION,NOT_IN_USE,INTERNAL_ERROR)OwnerSetRequest.validate()(empty name, none type),OwnerResponse.validate()(empty name, none type, no owner)